package pers.feng1240.blog.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import pers.feng1240.blog.dao.TagDao;
import pers.feng1240.blog.service.TagService;
import pers.feng1240.blog.util.PageHelper;

/*
 * 标签接口实现
 */
@Service("tagService")
public class TagServiceImpl implements TagService {

	@Resource
	private TagDao tagDao;	//数据访问
	
	/*
	 * 添加
	 */
	public void addObject(Object tag) {
		// TODO Auto-generated method stub
		tagDao.addObject(tag);

	}

	/*
	 * 分页列表
	 * @param pageIndex 要获取的页码	
	 * @see pers.feng1240.blog.service.AbstractService#getPageList(java.lang.String)
	 */
	public Map<String, Object> getPageList(int pageIndex) {
		Map<String,Object> mapRes = new HashMap<String,Object>();
		int count = tagDao.objectCount(); //对象总个数
		mapRes.put("count", count);
		mapRes.put("pageSize", PageHelper.pageSize(count));//页数
		mapRes.put("pageIndex", pageIndex); //
		mapRes.put("objectList", tagDao.getPageList(PageHelper.selObj(pageIndex)));
		return mapRes;
	}

	/*
	 * 列表
	 * @see pers.feng1240.blog.service.AbstractService#getObjectList()
	 */
	public List<Object> getObjectList() {
		// TODO Auto-generated method stub
		return tagDao.getObjectList();
	}
	
	/*
	 * 单条
	 */
	public Object getById(int id) {
		// TODO Auto-generated method stub
		return tagDao.getById(id);
	}

	/*
	 * 更新、修改
	 */
	public void updateObject(Object object) {
		// TODO Auto-generated method stub

	}

	/*
	 * 删除
	 * @see pers.feng1240.blog.service.AbstractService#deleteById(int)
	 */
	public void deleteById(int id) {
		tagDao.deleteById(id);
		
	}
}
